package com.zzyl.nursing.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.zzyl.nursing.dto.DeviceDataPageReqDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zzyl.common.annotation.Log;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.enums.BusinessType;
import com.zzyl.nursing.domain.DeviceData;
import com.zzyl.nursing.service.IDeviceDataService;
import com.zzyl.common.utils.poi.ExcelUtil;
import com.zzyl.common.core.page.TableDataInfo;

/**
 * 设备上传数据表Controller
 * 
 * @author 小新IP归属中国
 * @date 2025-07-01
 */
@RestController
@RequestMapping("/nursing/data")
@Api(tags = "设备上传数据表的接口")
public class DeviceDataController extends BaseController
{
    @Autowired
    private IDeviceDataService deviceDataService;

    /**
     * 查询设备上传数据表列表
     */
    @ApiOperation("查询设备上传数据表列表")
    @PreAuthorize("@ss.hasPermi('nursing:deviceData:list')")
    @GetMapping("/list")
    public TableDataInfo list(DeviceDataPageReqDto deviceData)
    {
    return deviceDataService.selectDeviceDataList(deviceData);
    }


    /**
     * 获取设备上传数据表详细信息
     */
    @ApiOperation("获取设备上传数据表详细信息")
    @PreAuthorize("@ss.hasPermi('nursing:deviceData:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@ApiParam(value = "设备上传数据表ID", required = true)
            @PathVariable("id") Long id)
    {
        return success(deviceDataService.selectDeviceDataById(id));
    }

    /**
     * 新增设备上传数据表
     */
    @ApiOperation("新增设备上传数据表")
    @PreAuthorize("@ss.hasPermi('nursing:deviceData:add')")
    @Log(title = "设备上传数据表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@ApiParam(value = "设备上传数据表实体")
            @RequestBody DeviceData deviceData)
    {
        return toAjax(deviceDataService.insertDeviceData(deviceData));
    }

    /**
     * 修改设备上传数据表
     */
    @ApiOperation("修改设备上传数据表")
    @PreAuthorize("@ss.hasPermi('nursing:deviceData:edit')")
    @Log(title = "设备上传数据表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@ApiParam(value = "设备上传数据表实体")
            @RequestBody DeviceData deviceData)
    {
        return toAjax(deviceDataService.updateDeviceData(deviceData));
    }

    /**
     * 删除设备上传数据表
     */
    @ApiOperation("删除设备上传数据表")
    @PreAuthorize("@ss.hasPermi('nursing:deviceData:remove')")
    @Log(title = "设备上传数据表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(deviceDataService.deleteDeviceDataByIds(ids));
    }
}
